package com.syq.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpSession;

/**
 * @ClassName: ResponseController
 * @Description: TODO
 * @Create by: syq
 * @Date: 2022/7/12 14:36
 */

@Controller
@RequestMapping("response")
public class ResponseController {

    @GetMapping("test1")
    public ModelAndView test1(HttpSession session, Model model){
        ModelAndView mav = new ModelAndView();
        mav.setViewName("hhh");
        mav.addObject("name","syq");
        mav.addObject("gender","男");
        mav.addObject("age","18");
        return mav ;
    }

    @GetMapping("test2")
    public String test1(Model model){

        model.addAttribute("name","syq");
        model.addAttribute("gender","男");
        model.addAttribute("age","18");
        return "hhh" ;
    }
}
